package com.cqcvc.mapper;

import com.cqcvc.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserMapper {
    @Update("update user set mm=#{newmm} where zh=#{zh} and mm=#{mm}")
    public int editPwd(@Param("zh") String zh,@Param("mm") String mm,@Param("newmm") String newmm);

    @Select("select * from user where zh=#{zh} and mm=#{mm}")
    public User login(@Param("zh") String zh,@Param("mm") String mm);


    //校验账号的唯一性
    @Select("select * from user where zh=#{zh}")
    public List<User> checkUserAccount(@Param("zh") String zh);


    //用户注册
    @Insert("INSERT INTO user(zh,mm,name) values(#{zh},#{mm},#{name})")
    public int register(@Param("zh") String zh, @Param("mm") String mm, @Param("name") String name);
}
